Skip to content

iwlwifi: Fix PTP clock removal race condition#1

Closed
Copilot wants to merge 2 commits into
masterfrom
copilot/fix-ptp-removal-race-condition
Closed

iwlwifi: Fix PTP clock removal race condition#1
Copilot wants to merge 2 commits into
masterfrom
copilot/fix-ptp-removal-race-condition

Conversation

Copy link
Copy Markdown

Copilot AI commented Feb 11, 2026

Problem

Both iwl_mvm_ptp_remove() and iwl_mld_ptp_remove() unregister the PTP clock before canceling delayed work, allowing the work function to access freed memory.

Changes

  • mvm/ptp.c: Move cancel_delayed_work_sync() before ptp_clock_unregister()
  • mld/ptp.c: Move cancel_delayed_work_sync() before ptp_clock_unregister()
void iwl_mvm_ptp_remove(struct iwl_mvm *mvm)
{
    if (mvm->ptp_data.ptp_clock) {
        // Cancel work before unregistering to prevent UAF
-       ptp_clock_unregister(mvm->ptp_data.ptp_clock);
-       mvm->ptp_data.ptp_clock = NULL;
-       // ... cleanup ...
-       cancel_delayed_work_sync(&mvm->ptp_data.dwork);
+       cancel_delayed_work_sync(&mvm->ptp_data.dwork);
+       ptp_clock_unregister(mvm->ptp_data.ptp_clock);
+       mvm->ptp_data.ptp_clock = NULL;
+       // ... cleanup ...
    }
}

Ensures no pending or running work can access the clock post-unregistration.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Move cancel_delayed_work_sync() before ptp_clock_unregister() in both
mvm and mld PTP implementations to prevent race condition where delayed
work could access the PTP clock after it has been unregistered.

Co-authored-by: Junjie650 <211438045+Junjie650@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix potential race condition in PTP removal for iwlwifi iwlwifi: Fix PTP clock removal race condition Feb 11, 2026
Copilot AI requested a review from Junjie650 February 11, 2026 07:03
@Junjie650 Junjie650 closed this Mar 20, 2026
@Junjie650 Junjie650 deleted the copilot/fix-ptp-removal-race-condition branch March 20, 2026 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants